package HomeWork.hw2;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Author Administrator
 * @Date 2020/5/21 14:38
 **/
@WebServlet("/refreshDemo2")
public class RefreshDemo2 extends HttpServlet {
    /*重定向到redirectDemo2
    * 响应码302，Location头  简化成：sendRedirect()*/

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.sendRedirect("/web/redirectDemo2");
    }
}
